<?php
/**
 * 我的简历页 的预览页
 * 仲伟涛 2011-3
 */
class Resume_Page_Preview extends Resume_Page_Abstract
{
    public function validate(ME_Request $input, ME_Response $output)
    {
        //获得登录的用户
        $input->jumpLogin   = true;
        $input->myLoginInfo = Libs_UcUser::checkLogin($input,$output);
        $output->uid        =
        $input->uid         = (int)$input->myLoginInfo['uid'];
        $input->userName    = $input->myLoginInfo['userName'];
        $output->myResumeConfig = ME_Config::get("MyResume");

        //后台也可以查看，但是需要验证
        $authcode = trim($input->get('code'));
        if($authcode){
            $authcode = str_replace('____','+',$authcode);
            $authcode_decode = Libs_UcUser::authcode($authcode, 'DECODE', 'ADMIN!@#$');
            $uid = str_replace('ADMINVIEW#####', '', $authcode_decode);
            if('ADMINVIEW#####' . $uid !=  $authcode_decode){
                echo 'Access Denied';
                exit;
            }
            $output->uid         =
            $input->uid          = $uid;
            $userInfo = Libs_UcUser::getUserInfo(array('nameOrId'=>$uid,'flag'=>1));
            $input->userName     = $userInfo['username'];
            $output->adminView    = true;
            //var_dump($userInfo);exit;
        }

        return true;
    }
    private function loadDb()
    {
        $this->resumeDb = Db_Resume::instance();
    }

    public function doDefault(ME_Request $input, ME_Response $output)
    {
        $this->loadDb();
        $output->pageType = 'preView';
        //区域隐藏信息
        $areaHideArr         = Resume_Plugin_MyResume::getAreaHideValueArr($input,$output);
        $output->areaHideArr = $areaHideArr;

        $output->baseInfo = Resume_Plugin_MyResume::getBaseInfo($input,$output);
        if($output->adminView || !isset($areaHideArr['edu']) || $areaHideArr['edu']) $output->eduList = Resume_Plugin_MyResume::getEduInfo($input,$output);
        if($output->adminView || !isset($areaHideArr['other']) || $areaHideArr['other']) $output->otherList = Resume_Plugin_MyResume::getOtherInfo($input,$output);
        if($output->adminView || !isset($areaHideArr['schoolaward']) || $areaHideArr['schoolaward']) $output->schoolAwardList = Resume_Plugin_MyResume::getSchoolAwardInfo($input,$output);
        if($output->adminView || !isset($areaHideArr['position']) || $areaHideArr['position']) $output->positionList    = Resume_Plugin_MyResume::getPositionInfo($input,$output);

        $output->languageList = Resume_Plugin_MyResume::getLanguageInfo($input, $output);
        $output->projectList = Resume_Plugin_MyResume::getProjectInfo($input, $output);
        $output->jobList = Resume_Plugin_MyResume::getJobInfo($input, $output);
        $output->jobhistoryList = Resume_Plugin_MyResume::getJobHistoryInfo($input, $output);
        $output->trainList = Resume_Plugin_MyResume::getTrainInfo($input, $output);
        $output->certList = Resume_Plugin_MyResume::getCertInfo($input, $output);
        $output->itList = Resume_Plugin_MyResume::getITInfo($input, $output);

        
        $output->setTemplate('MyResume/Preview');

    }



}

?>
